import { getEchoTextByValue, getEchoByOptions } from '@/utils/getUtils';
const COMMUNAL_OPTIONS = [
  { label: '是', value: '1' },
  { label: '否', value: '2' }
];
const commonColumns = [
  {
    title: '是否敏感',
    fixed: 'left',
    render: (h, { row }) => {
      return <span>{getEchoTextByValue({ val: row.isPriceSensitive })}</span>
    }
  },
  {
    title: '商品管理区域',
    key: 'productManagerArea',
    fixed: 'left',
  },
  {
    title: '供货单位',
    fixed: 'left',
    render: (h, { row }) => {
      return <span>{ row.supplyGoodsUnit || row.unitName }</span>
    }
  },
  {
    title: 'SKU编码',
    key: 'skuNo',
    fixed: 'left',
  },
  {
    title: '商品名称',
    key: 'productName',
    fixed: 'left',
  },
  {
    title: '规格',
    key: 'specDetailStr',
    fixed: 'left',
  },
]
const moreSupplyInfoColumns = [
  ...commonColumns,
  {
    title: '厂家商品代码',
    key: 'factoryCode',
    type: 'input'
  },
  {
    title: '厂家商品名称',
    key: 'factoryName',
    type: 'input'
  },
  {
    title: '最小订货量',
    key: 'minOrderGoodsNum',
    width: 180,
    type: 'inputNum'
  },
  {
    title: '是否保修',
    key: 'warrantyStatus',
    type: 'select',
    width: 100,
    options: COMMUNAL_OPTIONS
  },
  {
    title: '保修天数',
    key: 'warrantyDay',
    width: 180,
    type: 'inputNum'
  },
  {
    title: '是否可换货',
    key: 'exchangeGoodsStatus',
    width: 100,
    type: 'select',
    options: COMMUNAL_OPTIONS
  },
  {
    title: '换货天数',
    key: 'exchangeGoodsDay',
    width: 180,
    type: 'inputNum'
  },
  {
    title: '换货条件',
    key: 'exchangeGoodsCondition',
    type: 'input'
  },
  {
    title: '是否可退货',
    key: 'returnGoodsStatus',
    width: 100,
    type: 'select',
    options: COMMUNAL_OPTIONS
  },
  {
    title: '退货天数',
    key: 'returnGoodsDay',
    width: 180,
    type: 'inputNum'
  },
  {
    title: '退货条件',
    key: 'returnGoodsCondition',
    type: 'input'
  },
  {
    title: '最小退换货量',
    key: 'minReOrExNum',
    width: 180,
    type: 'inputNum'
  },
  {
    title: '商品销售最小残品值',
    key: 'minSaleImperfectionsNum',
    width: 180,
    type: 'inputNum'
  },
  {
    title: '商品包装',
    key: 'productPacking',
    type: 'input'
  },
  {
    title: '其他服务承诺',
    key: 'otherPromise',
    width: 150,
    type: 'inputNoLimit',
    maxlength: 100
  }
]

const viewMoreSupplyInfoColumns = [
  ...commonColumns,
  {
    title: '厂家商品代码',
    key: 'factoryCode',
  },
  {
    title: '厂家商品名称',
    key: 'factoryName',
  },
  {
    title: '最小订货量',
    key: 'minOrderGoodsNum',
  },
  {
    title: '是否保修',
    render: (h, { row }) => {
      return <span>{getEchoByOptions(row.warrantyStatus, COMMUNAL_OPTIONS)}</span>
    }
  },
  {
    title: '保修天数',
    key: 'warrantyDay',
  },
  {
    title: '是否可换货',
    render: (h, { row }) => {
      return <span>{getEchoByOptions(row.exchangeGoodsStatus, COMMUNAL_OPTIONS)}</span>
    }
  },
  {
    title: '换货天数',
    key: 'exchangeGoodsDay',
  },
  {
    title: '换货条件',
    key: 'exchangeGoodsCondition',
  },
  {
    title: '是否可退货',
    render: (h, { row }) => {
      return <span>{getEchoByOptions(row.returnGoodsStatus, COMMUNAL_OPTIONS)}</span>
    }
  },
  {
    title: '退货天数',
    key: 'returnGoodsDay',
  },
  {
    title: '退货条件',
    key: 'returnGoodsCondition',
  },
  {
    title: '最小退换货量',
    key: 'minReOrExNum',
  },
  {
    title: '商品销售最小残品值',
    key: 'minSaleImperfectionsNum',
  },
  {
    title: '商品包装',
    key: 'productPacking',
  },
  {
    title: '其他服务承诺',
    key: 'otherPromise',
  }
]
export default {
  moreSupplyInfoColumns,
  viewMoreSupplyInfoColumns
}
